from django.db import models

class Teacher(models.Model):
    teacher_id = models.CharField(max_length=20, unique=True, verbose_name='工号')
    name = models.CharField(max_length=50, verbose_name='姓名')
    department = models.CharField(max_length=100, verbose_name='所属院系')
    title = models.CharField(max_length=50, verbose_name='职称')
    gender = models.CharField(max_length=10, choices=[('M', '男'), ('F', '女')], verbose_name='性别')
    date_of_birth = models.DateField(verbose_name='出生日期')
    hire_date = models.DateField(verbose_name='入职日期')
    phone = models.CharField(max_length=15, blank=True, null=True, verbose_name='联系电话')
    email = models.EmailField(blank=True, null=True, verbose_name='电子邮箱')
    specialization = models.CharField(max_length=100, blank=True, null=True, verbose_name='专业方向')
    created_at = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')
    updated_at = models.DateTimeField(auto_now=True, verbose_name='更新时间')

    class Meta:
        verbose_name = '教师'
        verbose_name_plural = '教师'
        ordering = ['teacher_id']

    def __str__(self):
        return f"{self.teacher_id} - {self.name}"
